package com.example.projectmanagement.config;

import com.example.projectmanagement.interceptor.ApiMonitorInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
    
    @Autowired
    private ApiMonitorInterceptor apiMonitorInterceptor;
    
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 注册API监控拦截器，拦截所有API请求
        registry.addInterceptor(apiMonitorInterceptor)
                .addPathPatterns("/api/**")
                .excludePathPatterns("/api/auth/login", "/api/auth/register");
    }
}